require(ospsuite.reportingengine)
#> Loading required package: ospsuite.reportingengine
#> Loading required package: ospsuite
#> Loading required package: rClr
#> Loading the dynamic library for Microsoft .NET runtime...
#> Loaded Common Language Runtime version 4.0.30319.42000
#> Loading required package: tlf

This vignette focuses on time profiles and residuals plots (also called goodness of fit plots) generated using either mean model or population workflows.

Overview

The time profiles and residuals task first aims at generating time profile plots of specified simulation paths. The task can account for observed data, in which case residuals are calculated and plotted. For population workflows, aggregation functions are used, by default mean, median, 5th and 95th percentiles are computed and plotted in the time profiles.

Inputs

Results obtained from the simulate task and stored as csv files within the subdirectory SimulationResults from the workflowFolder directory are required in order to perform the goodness of fit (plotTimeProfilesAndResiduals) task. As a consequence, if the workflow output folder does not include the appropriate simulations, the task simulate needs to be active.

The objects SimulationSet (or PopulationSimulationSet for population workflows) and Output define which and how the simulated and, if available, observed data will be plotted.

Outputs

The time profiles and residuals task generates for each simulation set plots of:

  • the simulated time profile
    • in linear and logarithmic scale
    • if available with data
    • for total simulated time range.

Multiple applications

For simulations with multiple applications, up to 6 time profile plots can be generated corresponding to simulated time profiles in linear and logarithmic scale for:

  • the total simulated time range
  • the time range of the first application
  • the time range of the last application

The input applicationRanges from SimulationSet objects can be used to select which ranges to include in the evaluation.

Residuals

If observed data are available in the range selected in the output definition and selected in dataSelection, they will be added to the time profile plots.

Furthermore, residuals will be calculated according to the residual scale defined by the Output objects included within the simulation sets and 6 additional plots will be created figures:

  • Predicted vs observed in linear scale
  • Predicted vs observed in log scale
  • Residuals vs time
  • Residuals vs simulated output
  • Histogram of residuals
  • qq-plot of residuals

The residual scale corresponds to one element from the enum ResidualScales:

ResidualScales
#> $Linear
#> [1] "Linear"
#> 
#> $Logarithmic
#> [1] "Logarithmic"

The default uses “Logarithmic” and calculate residuals as: \(Residuals=log(Observed)-log(Simulated)\)

If the option “Linear” is used instead, the residuals are calculated as: \(Residuals=Observed-Simulated\)

A histogram and a qq-plot of residuals across all the simulation sets will also be added at the end of the analysis.

For population workflows, residuals are calculated from the aggregation of the Simulated output. By default, \(median(Simulated)\) is used instead of \(Simulated\). It is possible to modify this aggregation function by updating the fields of the object AggregationConfiguration.

Template examples

The following sections will introduce template scripts including goodness of fit tasks as well as their associated reports. Table 1 shows the features tested in each template script.

Table 1: Features tested by each template script
Example Workflow Simulation Sets Outputs Observed Data
1 Mean model 1 1 No
2 Mean model 1 1 Yes
3 Mean model 1 1 Yes
4 Mean model 1 2 Yes
5 Mean model 2 1 Yes
6 Population model 1 1 No
7 Population model 1 1 Yes

Example 1

Example 1 shows one of the simplest workflows including a goodness of fit. In this example, only a simulation time profile is performed since there is no observed data. Furthermore, only one simulation set and one output are requested.

# Get the pkml simulation file: "MiniModel2.pkml"
simulationFile <- system.file("extdata", "MiniModel2.pkml",
  package = "ospsuite.reportingengine"
)

# Define the input parameters
outputA <- Output$new(
  path = "Organism|A|Concentration in container",
  displayName = "Concentration of A",
  displayUnit = "nmol/ml"
)

setA <- SimulationSet$new(
  simulationSetName = "A",
  simulationFile = simulationFile,
  outputs = outputA
)

# Create the workflow instance
workflow1 <-
  MeanModelWorkflow$new(
    simulationSets = setA,
    workflowFolder = "Example-1"
  )
#>  [1] "22/09/2021 - 13:33:43 : Reporting Engine Information:"          
#>  [2] "22/09/2021 - 13:33:43 : Date: 22/09/2021 - 13:33:43"            
#>  [3] "22/09/2021 - 13:33:43 : User Information:"                      
#>  [4] "22/09/2021 - 13:33:43 : Computer Name: DESKTOP-0FPEDE6"         
#>  [5] "22/09/2021 - 13:33:43 : User: IndrajeetPatil"                   
#>  [6] "22/09/2021 - 13:33:43 : Login: IndrajeetPatil"                  
#>  [7] "22/09/2021 - 13:33:43 : System is NOT validated"                
#>  [8] "22/09/2021 - 13:33:43 : System versions:"                       
#>  [9] "22/09/2021 - 13:33:43 : R version: R version 4.1.1 (2021-08-10)"
#> [10] "22/09/2021 - 13:33:43 : OSP Suite Package version: 10.0.0"      
#> [11] "22/09/2021 - 13:33:43 : OSP Reporting Engine version: 1.2.0"    
#> [12] "22/09/2021 - 13:33:43 : tlf version: 1.2.0"
# Set the workflow tasks to be run
workflow1$activateTasks(c("simulate", "plotTimeProfilesAndResiduals"))

# Run the workflow
workflow1$runWorkflow()
#> [1] "22/09/2021 - 13:33:43 : Starting run of mean model workflow"
#> [1] "22/09/2021 - 13:33:43 : Starting Perform simulation task"
#> [1] "22/09/2021 - 13:33:43 : Starting: Plot Time profiles and Residuals task"
#> [1] "22/09/2021 - 13:33:43 : Report 'Example-1/appendix-time-profile.md' was initialized successfully."
#> [1] "22/09/2021 - 13:33:43 : Plot Time profiles and Residuals task for A"
#> [1] "22/09/2021 - 13:33:45 : Report 'Example-1/Report.md' was initialized successfully."
#> Executing: pandoc --self-contained --wrap=none --toc --reference-doc="C:/Users/IndrajeetPatil/AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/reference.docx" --lua-filter="C:/Users/IndrajeetPatil/AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/pagebreak.lua" --resource-path="Example-1" -t docx -o "Example-1/Report-word.docx" "Example-1/Report-word.md"

The output report for Example 1 is shown below. There are only 2 figures in the report (linear and log scales) showing the time profile of the output path ‘Organism|A|Concentration in container’ displayed as ‘Concentration of A’.

Report

1 Time profiles and residual plots

1.1 Time profiles and residual plots for A

Figure 1: Time profiles for A. Time profiles are plotted in a linear scale.

Figure 2: Time profiles for A. Time profiles are plotted in a logarithmic scale.

Example 2

Example 2 shows a workflow that used the simulation results performed in Example 1. This example shows 3 new features:

  • The presence of observed data compared to the simulation
  • The use of results obtained from a previous workflow
  • The change of display unit without re-running the simulate task
# Get the pkml simulation file: "MiniModel2.pkml"
simulationFile <- system.file("extdata", "MiniModel2.pkml",
  package = "ospsuite.reportingengine"
)

# Get the observation file and its dictionary
observationFile <- system.file("extdata", "SimpleData.nmdat",
  package = "ospsuite.reportingengine"
)
dictionaryFile <- system.file("extdata", "tpDictionary.csv",
  package = "ospsuite.reportingengine"
)

# Define the input parameters
outputA <- Output$new(
  path = "Organism|A|Concentration in container",
  displayName = "Simulated concentration of A",
  displayUnit = "µmol/ml",
  dataSelection = "MDV==0",
  dataDisplayName = "Observed concentration of A"
)

setA <- SimulationSet$new(
  simulationSetName = "A",
  simulationFile = simulationFile,
  outputs = outputA,
  observedDataFile = observationFile,
  observedMetaDataFile = dictionaryFile
)

# Create the workflow instance
workflow2 <-
  MeanModelWorkflow$new(
    simulationSets = setA,
    workflowFolder = "Example-1"
  )
#>  [1] "22/09/2021 - 13:33:46 : Reporting Engine Information:"          
#>  [2] "22/09/2021 - 13:33:46 : Date: 22/09/2021 - 13:33:46"            
#>  [3] "22/09/2021 - 13:33:46 : User Information:"                      
#>  [4] "22/09/2021 - 13:33:46 : Computer Name: DESKTOP-0FPEDE6"         
#>  [5] "22/09/2021 - 13:33:46 : User: IndrajeetPatil"                   
#>  [6] "22/09/2021 - 13:33:46 : Login: IndrajeetPatil"                  
#>  [7] "22/09/2021 - 13:33:46 : System is NOT validated"                
#>  [8] "22/09/2021 - 13:33:46 : System versions:"                       
#>  [9] "22/09/2021 - 13:33:46 : R version: R version 4.1.1 (2021-08-10)"
#> [10] "22/09/2021 - 13:33:46 : OSP Suite Package version: 10.0.0"      
#> [11] "22/09/2021 - 13:33:46 : OSP Reporting Engine version: 1.2.0"    
#> [12] "22/09/2021 - 13:33:46 : tlf version: 1.2.0"
# Set the workflow tasks to be run
workflow2$activateTasks("plotTimeProfilesAndResiduals")
workflow2$inactivateTasks("simulate")

# Run the workflow
workflow2$runWorkflow()
#> [1] "22/09/2021 - 13:33:46 : Starting run of mean model workflow"
#> [1] "22/09/2021 - 13:33:46 : Starting: Plot Time profiles and Residuals task"
#> [1] "22/09/2021 - 13:33:46 : Report 'Example-1/appendix-time-profile.md' was initialized successfully."
#> [1] "22/09/2021 - 13:33:46 : Plot Time profiles and Residuals task for A"
#> [1] "22/09/2021 - 13:33:51 : 'Example-1/Report.md' already exists. Overwriting 'Example-1/Report.md'."
#> [1] "22/09/2021 - 13:33:51 : Report 'Example-1/Report.md' was initialized successfully."
#> Executing: pandoc --self-contained --wrap=none --toc --reference-doc="C:/Users/IndrajeetPatil/AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/reference.docx" --lua-filter="C:/Users/IndrajeetPatil/AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/pagebreak.lua" --resource-path="Example-1" -t docx -o "Example-1/Report-word.docx" "Example-1/Report-word.md"

It can be seen from the run results that the task simulate was not run.

In this example, the content of the observed data file and its dictionary are respectively described Table 2 and 3.

Table 2: Observed data content
ID STUD SID TIME TAD DV CMT MDV AMT WGHT HGHT SEX AGE LOQ
1 9999 1 0 0 0.00000 2 1 450 82 160 1 32 0.001
2 9999 1 2 2 0.00120 1 0 0 82 160 1 32 0.001
3 9999 1 4 4 0.00142 1 0 0 82 160 1 32 0.001
4 9999 1 6 6 0.00163 1 0 0 82 160 1 32 0.001
5 9999 1 8 8 0.00269 1 0 0 82 160 1 32 0.001
Table 3: Dictionary content
ID type datasetColumn datasetUnit reportName pathID comment
sid identifier SID
stud identifier STUD
time timeprofile TIME h
dv timeprofile DV mg/ml
tad timeprofile TAD h
age covariate AGE year(s) Age Organism|Age
wght covariate WGHT kg Body weight Organism|Weight
hght covariate HGHT cm Height Organism|Height
bmi covariate BMI kg/m2 BMI Organism|BMI
gender covariate SEX SEX Gender Make sure 1=male 2= female

The output report for Example 2 is shown below. There are now many more figures in the report showing not only time profiles in µmol/ml instead of nmol/ml but also residuals.

Report

1 Time profiles and residual plots

1.1 Time profiles and residual plots for A

Figure 1: Time profiles for A. Data source: AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/SimpleData.nmdat. Time profiles are plotted in a linear scale.

Figure 2: Time profiles for A. Data source: AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/SimpleData.nmdat. Time profiles are plotted in a logarithmic scale.

Figure 3: Predicted vs observed for A. Data source: AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/SimpleData.nmdat. Predictions and observations are plotted in a linear scale.

Figure 4: Predicted vs observed for A. Data source: AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/SimpleData.nmdat. Predictions and observations are plotted in a logarithmic scale.

Figure 5: Logarithmic residuals vs predicted values for A. Data source: AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/SimpleData.nmdat.

Figure 6: Logarithmic residuals vs time values for A. Data source: AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/SimpleData.nmdat.

Figure 7: Logarithmic residuals distribution for A. Data source: AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/SimpleData.nmdat.

Figure 8: Logarithmic residuals for A. Data source: AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/SimpleData.nmdat.

1.2 Residuals across all simulations

Figure 9: Distribution of residuals for A.

Figure 10: Residuals for A as quantile-quantile plot.

Example 3

In example 3, the dictionary is changed and indicates that the lower limit of quantitation (LLOQ) is included in the observed data. Like the previous example, there is no need to re-run the simulate task.

# Get the pkml simulation file: "MiniModel2.pkml"
simulationFile <- system.file("extdata", "MiniModel2.pkml",
  package = "ospsuite.reportingengine"
)

# Get the observation file and its dictionary
observationFile <- system.file("extdata", "SimpleData.nmdat",
  package = "ospsuite.reportingengine"
)
dictionaryFile <- system.file("extdata", "tpDictionaryLoq.csv",
  package = "ospsuite.reportingengine"
)

# Define the input parameters
outputA <- Output$new(
  path = "Organism|A|Concentration in container",
  displayName = "Simulated concentration of A",
  displayUnit = "µmol/ml",
  dataSelection = "MDV==0",
  dataDisplayName = "Observed concentration of A"
)

setA <- SimulationSet$new(
  simulationSetName = "A",
  simulationFile = simulationFile,
  outputs = outputA,
  observedDataFile = observationFile,
  observedMetaDataFile = dictionaryFile
)

# Create the workflow instance
workflow3 <-
  MeanModelWorkflow$new(
    simulationSets = setA,
    workflowFolder = "Example-1"
  )
#>  [1] "22/09/2021 - 13:33:52 : Reporting Engine Information:"          
#>  [2] "22/09/2021 - 13:33:52 : Date: 22/09/2021 - 13:33:52"            
#>  [3] "22/09/2021 - 13:33:52 : User Information:"                      
#>  [4] "22/09/2021 - 13:33:52 : Computer Name: DESKTOP-0FPEDE6"         
#>  [5] "22/09/2021 - 13:33:52 : User: IndrajeetPatil"                   
#>  [6] "22/09/2021 - 13:33:52 : Login: IndrajeetPatil"                  
#>  [7] "22/09/2021 - 13:33:52 : System is NOT validated"                
#>  [8] "22/09/2021 - 13:33:52 : System versions:"                       
#>  [9] "22/09/2021 - 13:33:52 : R version: R version 4.1.1 (2021-08-10)"
#> [10] "22/09/2021 - 13:33:52 : OSP Suite Package version: 10.0.0"      
#> [11] "22/09/2021 - 13:33:52 : OSP Reporting Engine version: 1.2.0"    
#> [12] "22/09/2021 - 13:33:52 : tlf version: 1.2.0"
# Set the workflow tasks to be run
workflow3$activateTasks("plotTimeProfilesAndResiduals")
workflow3$inactivateTasks("simulate")

# Run the workflow
workflow3$runWorkflow()
#> [1] "22/09/2021 - 13:33:52 : Starting run of mean model workflow"
#> [1] "22/09/2021 - 13:33:52 : Starting: Plot Time profiles and Residuals task"
#> [1] "22/09/2021 - 13:33:52 : Report 'Example-1/appendix-time-profile.md' was initialized successfully."
#> [1] "22/09/2021 - 13:33:52 : Plot Time profiles and Residuals task for A"
#> [1] "22/09/2021 - 13:33:57 : 'Example-1/Report.md' already exists. Overwriting 'Example-1/Report.md'."
#> [1] "22/09/2021 - 13:33:57 : Report 'Example-1/Report.md' was initialized successfully."
#> Executing: pandoc --self-contained --wrap=none --toc --reference-doc="C:/Users/IndrajeetPatil/AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/reference.docx" --lua-filter="C:/Users/IndrajeetPatil/AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/pagebreak.lua" --resource-path="Example-1" -t docx -o "Example-1/Report-word.docx" "Example-1/Report-word.md"

The new dictionary content is described in Table 4.

Table 4: Dictionary content
ID type datasetColumn datasetUnit reportName pathID comment
sid identifier SID
stud identifier STUD
time timeprofile TIME h
dv timeprofile DV mg/ml
tad timeprofile TAD h
age covariate AGE year(s) Age Organism|Age
wght covariate WGHT kg Body weight Organism|Weight
hght covariate HGHT cm Height Organism|Height
bmi covariate BMI kg/m2 BMI Organism|BMI
gender covariate SEX SEX Gender Make sure 1=male 2= female
lloq timeprofile LOQ units are defined in corresponding output definitions

The output report for Example 3 is shown below. The time profiles now indicate the LLOQ.

Report

1 Time profiles and residual plots

1.1 Time profiles and residual plots for A

Figure 1: Time profiles for A. Data source: AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/SimpleData.nmdat. Time profiles are plotted in a linear scale.

Figure 2: Time profiles for A. Data source: AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/SimpleData.nmdat. Time profiles are plotted in a logarithmic scale.

Figure 3: Predicted vs observed for A. Data source: AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/SimpleData.nmdat. Predictions and observations are plotted in a linear scale.

Figure 4: Predicted vs observed for A. Data source: AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/SimpleData.nmdat. Predictions and observations are plotted in a logarithmic scale.

Figure 5: Logarithmic residuals vs predicted values for A. Data source: AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/SimpleData.nmdat.

Figure 6: Logarithmic residuals vs time values for A. Data source: AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/SimpleData.nmdat.

Figure 7: Logarithmic residuals distribution for A. Data source: AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/SimpleData.nmdat.

Figure 8: Logarithmic residuals for A. Data source: AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/SimpleData.nmdat.

1.2 Residuals across all simulations

Figure 9: Distribution of residuals for A.

Figure 10: Residuals for A as quantile-quantile plot.

Example 4

In example 4, the simulation set now includes 2 output paths. Output path Organism|A|Concentration in container has observed data to be compared to whereas output path Organism|B|Concentration in container does not. Since output path Organism|B|Concentration in container was not requested by the examples 1, 2 and 3, it is not included in the simulation results. As a consequence, the simulate task needs to be re-run.

# Get the pkml simulation file: "MiniModel2.pkml"
simulationFile <- system.file("extdata", "MiniModel2.pkml",
  package = "ospsuite.reportingengine"
)

# Get the observation file and its dictionary
observationFile <- system.file("extdata", "SimpleData.nmdat",
  package = "ospsuite.reportingengine"
)
dictionaryFile <- system.file("extdata", "tpDictionary.csv",
  package = "ospsuite.reportingengine"
)

# Define the input parameters
outputA <- Output$new(
  path = "Organism|A|Concentration in container",
  displayName = "Simulated concentration of A",
  displayUnit = "µmol/ml",
  dataSelection = "MDV==0",
  dataDisplayName = "Observed concentration of A"
)
outputB <- Output$new(
  path = "Organism|B|Concentration in container",
  displayName = "Simulated concentration of B",
  displayUnit = "µmol/ml"
)

setAB <- SimulationSet$new(
  simulationSetName = "A and B",
  simulationFile = simulationFile,
  outputs = c(outputA, outputB),
  observedDataFile = observationFile,
  observedMetaDataFile = dictionaryFile
)

# Create the workflow instance
workflow4 <-
  MeanModelWorkflow$new(
    simulationSets = setAB,
    workflowFolder = "Example-4"
  )
#>  [1] "22/09/2021 - 13:33:59 : Reporting Engine Information:"          
#>  [2] "22/09/2021 - 13:33:59 : Date: 22/09/2021 - 13:33:59"            
#>  [3] "22/09/2021 - 13:33:59 : User Information:"                      
#>  [4] "22/09/2021 - 13:33:59 : Computer Name: DESKTOP-0FPEDE6"         
#>  [5] "22/09/2021 - 13:33:59 : User: IndrajeetPatil"                   
#>  [6] "22/09/2021 - 13:33:59 : Login: IndrajeetPatil"                  
#>  [7] "22/09/2021 - 13:33:59 : System is NOT validated"                
#>  [8] "22/09/2021 - 13:33:59 : System versions:"                       
#>  [9] "22/09/2021 - 13:33:59 : R version: R version 4.1.1 (2021-08-10)"
#> [10] "22/09/2021 - 13:33:59 : OSP Suite Package version: 10.0.0"      
#> [11] "22/09/2021 - 13:33:59 : OSP Reporting Engine version: 1.2.0"    
#> [12] "22/09/2021 - 13:33:59 : tlf version: 1.2.0"
# Set the workflow tasks to be run
workflow4$activateTasks(c("simulate", "plotTimeProfilesAndResiduals"))

# Run the workflow
workflow4$runWorkflow()
#> [1] "22/09/2021 - 13:33:59 : Starting run of mean model workflow"
#> [1] "22/09/2021 - 13:33:59 : Starting Perform simulation task"
#> [1] "22/09/2021 - 13:33:59 : Starting: Plot Time profiles and Residuals task"
#> [1] "22/09/2021 - 13:33:59 : Report 'Example-4/appendix-time-profile.md' was initialized successfully."
#> [1] "22/09/2021 - 13:33:59 : Plot Time profiles and Residuals task for A and B"
#> [1] "22/09/2021 - 13:34:03 : Report 'Example-4/Report.md' was initialized successfully."
#> Executing: pandoc --self-contained --wrap=none --toc --reference-doc="C:/Users/IndrajeetPatil/AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/reference.docx" --lua-filter="C:/Users/IndrajeetPatil/AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/pagebreak.lua" --resource-path="Example-4" -t docx -o "Example-4/Report-word.docx" "Example-4/Report-word.md"

The output report for Example 4 is shown below.

Report

1 Time profiles and residual plots

1.1 Time profiles and residual plots for A and B

Figure 1: Time profiles for A and B. Data source: AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/SimpleData.nmdat. Time profiles are plotted in a linear scale.

Figure 2: Time profiles for A and B. Data source: AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/SimpleData.nmdat. Time profiles are plotted in a logarithmic scale.

Figure 3: Predicted vs observed for A and B. Data source: AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/SimpleData.nmdat. Predictions and observations are plotted in a linear scale.

Figure 4: Predicted vs observed for A and B. Data source: AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/SimpleData.nmdat. Predictions and observations are plotted in a logarithmic scale.

Figure 5: Logarithmic residuals vs predicted values for A and B. Data source: AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/SimpleData.nmdat.

Figure 6: Logarithmic residuals vs time values for A and B. Data source: AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/SimpleData.nmdat.

Figure 7: Logarithmic residuals distribution for A and B. Data source: AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/SimpleData.nmdat.

Figure 8: Logarithmic residuals for A and B. Data source: AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/SimpleData.nmdat.

1.2 Residuals across all simulations

Figure 9: Distribution of residuals for A and B.

Figure 10: Residuals for A and B as quantile-quantile plot.

Example 5

In example 5, there are 2 simulation sets, each one includes one output path. Simulation set A includes output path Organism|A|Concentration in container and has observed data. Simulation set B includes output path Organism|B|Concentration in container and has no observed data. The simulate task needs to be re-run also in this case since the simulation results are saved in files that use the simulation set names.

# Get the pkml simulation file: "MiniModel2.pkml"
simulationFile <- system.file("extdata", "MiniModel2.pkml",
  package = "ospsuite.reportingengine"
)

# Get the observation file and its dictionary
observationFile <- system.file("extdata", "SimpleData.nmdat",
  package = "ospsuite.reportingengine"
)
dictionaryFile <- system.file("extdata", "tpDictionary.csv",
  package = "ospsuite.reportingengine"
)

# Define the input parameters
outputA <- Output$new(
  path = "Organism|A|Concentration in container",
  displayName = "Simulated concentration of A",
  displayUnit = "µmol/ml",
  dataSelection = "MDV==0",
  dataDisplayName = "Observed concentration of A"
)
outputB <- Output$new(
  path = "Organism|B|Concentration in container",
  displayName = "Simulated concentration of B",
  displayUnit = "µmol/ml"
)

setA <- SimulationSet$new(
  simulationSetName = "A",
  simulationFile = simulationFile,
  outputs = outputA,
  observedDataFile = observationFile,
  observedMetaDataFile = dictionaryFile
)
setB <- SimulationSet$new(
  simulationSetName = "B",
  simulationFile = simulationFile,
  outputs = outputB
)

# Create the workflow instance
workflow5 <-
  MeanModelWorkflow$new(
    simulationSets = c(setA, setB),
    workflowFolder = "Example-5"
  )
#>  [1] "22/09/2021 - 13:34:04 : Reporting Engine Information:"          
#>  [2] "22/09/2021 - 13:34:04 : Date: 22/09/2021 - 13:34:04"            
#>  [3] "22/09/2021 - 13:34:04 : User Information:"                      
#>  [4] "22/09/2021 - 13:34:04 : Computer Name: DESKTOP-0FPEDE6"         
#>  [5] "22/09/2021 - 13:34:04 : User: IndrajeetPatil"                   
#>  [6] "22/09/2021 - 13:34:04 : Login: IndrajeetPatil"                  
#>  [7] "22/09/2021 - 13:34:04 : System is NOT validated"                
#>  [8] "22/09/2021 - 13:34:04 : System versions:"                       
#>  [9] "22/09/2021 - 13:34:04 : R version: R version 4.1.1 (2021-08-10)"
#> [10] "22/09/2021 - 13:34:04 : OSP Suite Package version: 10.0.0"      
#> [11] "22/09/2021 - 13:34:04 : OSP Reporting Engine version: 1.2.0"    
#> [12] "22/09/2021 - 13:34:04 : tlf version: 1.2.0"
# Set the workflow tasks to be run
workflow5$activateTasks(c("simulate", "plotTimeProfilesAndResiduals"))

# Run the workflow
workflow5$runWorkflow()
#> [1] "22/09/2021 - 13:34:04 : Starting run of mean model workflow"
#> [1] "22/09/2021 - 13:34:04 : Starting Perform simulation task"
#> [1] "22/09/2021 - 13:34:04 : Starting: Plot Time profiles and Residuals task"
#> [1] "22/09/2021 - 13:34:04 : Report 'Example-5/appendix-time-profile.md' was initialized successfully."
#> [1] "22/09/2021 - 13:34:04 : Plot Time profiles and Residuals task for A"
#> [1] "22/09/2021 - 13:34:08 : Plot Time profiles and Residuals task for B"
#> [1] "22/09/2021 - 13:34:09 : Report 'Example-5/Report.md' was initialized successfully."
#> Executing: pandoc --self-contained --wrap=none --toc --reference-doc="C:/Users/IndrajeetPatil/AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/reference.docx" --lua-filter="C:/Users/IndrajeetPatil/AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/pagebreak.lua" --resource-path="Example-5" -t docx -o "Example-5/Report-word.docx" "Example-5/Report-word.md"

The output report for Example 5 is shown below.

Report

1 Time profiles and residual plots

1.1 Time profiles and residual plots for A

Figure 1: Time profiles for A. Data source: AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/SimpleData.nmdat. Time profiles are plotted in a linear scale.

Figure 2: Time profiles for A. Data source: AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/SimpleData.nmdat. Time profiles are plotted in a logarithmic scale.

Figure 3: Predicted vs observed for A. Data source: AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/SimpleData.nmdat. Predictions and observations are plotted in a linear scale.

Figure 4: Predicted vs observed for A. Data source: AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/SimpleData.nmdat. Predictions and observations are plotted in a logarithmic scale.

Figure 5: Logarithmic residuals vs predicted values for A. Data source: AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/SimpleData.nmdat.

Figure 6: Logarithmic residuals vs time values for A. Data source: AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/SimpleData.nmdat.

Figure 7: Logarithmic residuals distribution for A. Data source: AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/SimpleData.nmdat.

Figure 8: Logarithmic residuals for A. Data source: AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/SimpleData.nmdat.

1.2 Time profiles and residual plots for B

Figure 9: Time profiles for B. Time profiles are plotted in a linear scale.

Figure 10: Time profiles for B. Time profiles are plotted in a logarithmic scale.

1.3 Residuals across all simulations

Figure 11: Distribution of residuals for A, B.

Figure 12: Residuals for A, B as quantile-quantile plot.

Example 6

Example 6 shows a goodness of fit for a population workflow. In this example, there is no observed data, only one simulation set and one output are requested.

# Get the pkml simulation file: "MiniModel2.pkml"
simulationFile <- system.file("extdata", "MiniModel2.pkml",
  package = "ospsuite.reportingengine"
)

populationFile <- system.file("extdata", "Pop500_p1p2p3.csv",
  package = "ospsuite.reportingengine"
)

# Define the input parameters
outputA <- Output$new(
  path = "Organism|A|Concentration in container",
  displayName = "Concentration of A",
  displayUnit = "µmol/ml"
)

setA <- PopulationSimulationSet$new(
  simulationSetName = "A",
  simulationFile = simulationFile,
  populationFile = populationFile,
  outputs = outputA
)

# Create the workflow instance
workflow6 <-
  PopulationWorkflow$new(
    workflowType = PopulationWorkflowTypes$parallelComparison,
    simulationSets = setA,
    workflowFolder = "Example-6"
  )
#>  [1] "22/09/2021 - 13:34:11 : Reporting Engine Information:"          
#>  [2] "22/09/2021 - 13:34:11 : Date: 22/09/2021 - 13:34:11"            
#>  [3] "22/09/2021 - 13:34:11 : User Information:"                      
#>  [4] "22/09/2021 - 13:34:11 : Computer Name: DESKTOP-0FPEDE6"         
#>  [5] "22/09/2021 - 13:34:11 : User: IndrajeetPatil"                   
#>  [6] "22/09/2021 - 13:34:11 : Login: IndrajeetPatil"                  
#>  [7] "22/09/2021 - 13:34:11 : System is NOT validated"                
#>  [8] "22/09/2021 - 13:34:11 : System versions:"                       
#>  [9] "22/09/2021 - 13:34:11 : R version: R version 4.1.1 (2021-08-10)"
#> [10] "22/09/2021 - 13:34:11 : OSP Suite Package version: 10.0.0"      
#> [11] "22/09/2021 - 13:34:11 : OSP Reporting Engine version: 1.2.0"    
#> [12] "22/09/2021 - 13:34:11 : tlf version: 1.2.0"
# Set the workflow tasks to be run
workflow6$activateTasks(c("simulate", "plotTimeProfilesAndResiduals"))

# Run the workflow
workflow6$runWorkflow()
#> [1] "22/09/2021 - 13:34:11 : Starting run of population workflow"
#> [1] "22/09/2021 - 13:34:11 : Starting Perform simulation task"
#> [1] "22/09/2021 - 13:34:11 : Run simulation in simulation set: A"
#> [1] "22/09/2021 - 13:34:11 : Starting: Plot Time profiles and Residuals task"
#> [1] "22/09/2021 - 13:34:11 : Report 'Example-6/appendix-time-profile.md' was initialized successfully."
#> [1] "22/09/2021 - 13:34:11 : Plot Time profiles and Residuals task for A"
#> [1] "22/09/2021 - 13:34:13 : Report 'Example-6/Report.md' was initialized successfully."
#> Executing: pandoc --self-contained --wrap=none --toc --reference-doc="C:/Users/IndrajeetPatil/AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/reference.docx" --lua-filter="C:/Users/IndrajeetPatil/AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/pagebreak.lua" --resource-path="Example-6" -t docx -o "Example-6/Report-word.docx" "Example-6/Report-word.md"

The output report for Example 6 is shown below. The 2 figures of the report (linear and log scales) include median, mean 5th and 95th percentiles of the population.

Report

1 Time profiles and residual plots

1.1 Time profiles and residual plots for A

Figure 1: Time profiles for A. Time profiles are plotted in a linear scale.

Figure 2: Time profiles for A. Time profiles are plotted in a logarithmic scale.

Example 7

Example 7 add observed data to the previous workflow.

# Get the pkml simulation file: "MiniModel2.pkml"
simulationFile <- system.file("extdata", "MiniModel2.pkml",
  package = "ospsuite.reportingengine"
)
populationFile <- system.file("extdata", "Pop500_p1p2p3.csv",
  package = "ospsuite.reportingengine"
)

# Get the observation file and its dictionary
observationFile <- system.file("extdata", "SimpleData.nmdat",
  package = "ospsuite.reportingengine"
)
dictionaryFile <- system.file("extdata", "tpDictionary.csv",
  package = "ospsuite.reportingengine"
)

# Define the input parameters
outputA <- Output$new(
  path = "Organism|A|Concentration in container",
  displayName = "Simulated concentration of A",
  displayUnit = "µmol/ml",
  dataSelection = "MDV==0",
  dataDisplayName = "Observed concentration of A"
)

setA <- PopulationSimulationSet$new(
  simulationSetName = "A",
  simulationFile = simulationFile,
  populationFile = populationFile,
  outputs = outputA,
  observedDataFile = observationFile,
  observedMetaDataFile = dictionaryFile
)

# Create the workflow instance
workflow7 <-
  PopulationWorkflow$new(
    workflowType = PopulationWorkflowTypes$parallelComparison,
    simulationSets = setA,
    workflowFolder = "Example-6"
  )
#>  [1] "22/09/2021 - 13:34:14 : Reporting Engine Information:"          
#>  [2] "22/09/2021 - 13:34:14 : Date: 22/09/2021 - 13:34:14"            
#>  [3] "22/09/2021 - 13:34:14 : User Information:"                      
#>  [4] "22/09/2021 - 13:34:14 : Computer Name: DESKTOP-0FPEDE6"         
#>  [5] "22/09/2021 - 13:34:14 : User: IndrajeetPatil"                   
#>  [6] "22/09/2021 - 13:34:14 : Login: IndrajeetPatil"                  
#>  [7] "22/09/2021 - 13:34:14 : System is NOT validated"                
#>  [8] "22/09/2021 - 13:34:14 : System versions:"                       
#>  [9] "22/09/2021 - 13:34:14 : R version: R version 4.1.1 (2021-08-10)"
#> [10] "22/09/2021 - 13:34:14 : OSP Suite Package version: 10.0.0"      
#> [11] "22/09/2021 - 13:34:14 : OSP Reporting Engine version: 1.2.0"    
#> [12] "22/09/2021 - 13:34:14 : tlf version: 1.2.0"
# Set the workflow tasks to be run
workflow7$activateTasks(StandardPlotTasks$plotTimeProfilesAndResiduals)
workflow7$inactivateTasks(StandardSimulationTasks$simulate)

# Run the workflow
workflow7$runWorkflow()
#> [1] "22/09/2021 - 13:34:14 : Starting run of population workflow"
#> [1] "22/09/2021 - 13:34:14 : Starting: Plot Time profiles and Residuals task"
#> [1] "22/09/2021 - 13:34:14 : Report 'Example-6/appendix-time-profile.md' was initialized successfully."
#> [1] "22/09/2021 - 13:34:14 : Plot Time profiles and Residuals task for A"
#> [1] "22/09/2021 - 13:34:19 : 'Example-6/Report.md' already exists. Overwriting 'Example-6/Report.md'."
#> [1] "22/09/2021 - 13:34:19 : Report 'Example-6/Report.md' was initialized successfully."
#> Executing: pandoc --self-contained --wrap=none --toc --reference-doc="C:/Users/IndrajeetPatil/AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/reference.docx" --lua-filter="C:/Users/IndrajeetPatil/AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/pagebreak.lua" --resource-path="Example-6" -t docx -o "Example-6/Report-word.docx" "Example-6/Report-word.md"

The output report for Example 7 is shown below. The residuals are calculated on the median simulated values.

Report

1 Time profiles and residual plots

1.1 Time profiles and residual plots for A

Figure 1: Time profiles for A. Data source: AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/SimpleData.nmdat. Time profiles are plotted in a linear scale.

Figure 2: Time profiles for A. Data source: AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/SimpleData.nmdat. Time profiles are plotted in a logarithmic scale.

Figure 3: Predicted vs observed for A. Data source: AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/SimpleData.nmdat. Predictions and observations are plotted in a linear scale.

Figure 4: Predicted vs observed for A. Data source: AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/SimpleData.nmdat. Predictions and observations are plotted in a logarithmic scale.

Figure 5: Logarithmic residuals vs predicted values for A. Data source: AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/SimpleData.nmdat.

Figure 6: Logarithmic residuals vs time values for A. Data source: AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/SimpleData.nmdat.

Figure 7: Logarithmic residuals distribution for A. Data source: AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/SimpleData.nmdat.

Figure 8: Logarithmic residuals for A. Data source: AppData/Local/Temp/RtmpS0u3oG/temp_libpath4dbc69df2003/ospsuite.reportingengine/extdata/SimpleData.nmdat.

1.2 Residuals across all simulations

Figure 9: Distribution of residuals for A.

Figure 10: Residuals for A as quantile-quantile plot.